import { UIMessage,sendMsgToUI } from '@messages/sender'

mg.showUI(__html__)

mg.ui.onmessage = (msg: { type: UIMessage, data: any }) => {
  const { type, data } = msg
  console.log('receive msg from ui', msg)
   if (type === UIMessage.D2C) {
    let selection: SceneNode = mg.document.currentPage.selection[0]
    console.log(selection)
    let view;
    switch (selection.type) {
      case 'TEXT':
        break;
    }
    console.log("send msg to plugin", null)
    sendMsgToUI({
      type: UIMessage.D2C,
      data: null
    })
  }
}